package com.ccb.bank.controller;


import com.alibaba.fastjson.JSONObject;
import com.ccb.bank.entity.User;
import com.ccb.bank.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-11-04
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/{id}")
    @ResponseBody
    public String getUser(@PathVariable int id){
        User user = userService.selectUserById(id);
        return JSONObject.toJSONString(user);

    }
}

